package com.junmeng.libfloating.util

import android.content.Context
import android.content.Intent
import android.net.Uri
import android.provider.Settings

object SystemSettingPageUtil {
    /**
     * 跳转到应用悬浮窗权限设置页
     *
     * @param context
     */
    fun gotoAppOverlayPermissionSettingPage(context: Context) {
        val intent = Intent(
            Settings.ACTION_MANAGE_OVERLAY_PERMISSION,
            Uri.parse("package:" + context.packageName)
        )
        context.startActivity(intent)
    }

    /**
     * 跳转到系统投屏设置页
     *
     * @param context
     */
    fun gotoCastSettingPage(context: Context) {
        val intent = Intent(Settings.ACTION_CAST_SETTINGS)
        context.startActivity(intent)
    }

    /**
     * 跳转到应用权限、通知等设置页
     *
     * @param context
     */
    fun gotoAppDetailsSettingPage(context: Context) {
        val intent = Intent()
        intent.action = Settings.ACTION_APPLICATION_DETAILS_SETTINGS
        //        intent.setData(Uri.fromParts("package", context.getPackageName(), null));
        intent.data = Uri.parse("package:" + context.packageName)
        context.startActivity(intent)
    }
}